// 对浏览器内置 API 做兼容
// import 'react-app-polyfill/ie11'
// import 'react-app-polyfill/ie9'
// import 'react-app-polyfill/stable'

import React from 'react';
import ReactDOM from 'react-dom/client';
import { ConfigProvider } from 'antd';
import { HashRouter } from 'react-router-dom'

import zhCN from 'antd/locale/zh_CN'

import '@/index.less'

import FastClick from 'fastclick'
// TODO: 在这里直接写代码逻辑 编译会报错 需要查看编译逻辑
// FastClick.attach(document.body)

// import xxx from xxx // 如果上面有逻辑，下面这里又存在引用，会有报错
import Demo from './views/Demo'
import Vote from './views2/index'
import Vote2 from './views3/index'
import App from './view-router/App'

import ThemeContext from './ThemeContext';
import store from './store-redux/index'

import { Provider } from 'react-redux'
// import { Provider } from './myReactRedux'

// FastClick.attach(document.body)

// console.dir(FastClick)
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <ConfigProvider locale={zhCN}>
    {/* <Demo></Demo> */}
    {/* <ThemeContext.Provider value={{
      store
    }}>
      <Vote></Vote>
    </ThemeContext.Provider> */}

    {/* <Provider store={store}>
      <Vote2></Vote2>
    </Provider> */}

    <Provider store={store}>
      <App />
    </Provider>

    {/* 使用 useRoutes 时，需要将 App 包裹起来 */}
    {/* <Provider store={store}>
      <HashRouter>
        <App />
      </HashRouter>
    </Provider> */}
  </ConfigProvider>
);

// 测试跨域代理是否好使
// fetch('/jian/subscriptions/recommended_collections')
//   .then(response => response.json())
//   .then(value => {
//     console.log('vaule1: ', value)
//   })

// fetch('/zhi/news/latest')
//   .then(response => response.json())
//   .then(value => {
//     console.log('vaule2: ', value)
//   })
